home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QuickTime 1.0 for Developers
/
QuickTime 1.0 for Developers.iso
/
Programming Stuff
/
Interfaces
/
Oldstyle C Interfaces
/
Movies Format.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-06
|
13KB
|
544 lines
/* MooV Format.h
Format of the MooV resource
by Jim Batson, Bruce Leak, David Van Brink, Mark Krueger, Peter Hoddie, the vacationing Eric Hoffert
Copyright 1990 Apple Computer, Inc. All rights reserved.
*/
#ifndef _MoviesFormat_
#define _MoviesFormat_
#ifndef _Movies_
#include "Movies.h"
#endif _MoviesPrivate_
#define kMovieVersion (-1) /* version number of the format here described */
#ifndef kSmallestArray
#define kSmallestArray 1
#endif
/****************************************
*
* General Types -
* These types are used in more than one of the
* directory types.
*
****************************************/
/* MoviesUserData is the type used for user data in movie and track directories */
typedef struct {
long size; /* size of this user data */
long type; /* type of user data */
char data[kSmallestArray]; /* the user data */
} MoviesUserData;
typedef struct {
long size;
long type; /* = 'udat' */
MoviesUserData userData[kSmallestArray];
} UserDataAtom;
/* MoviesDataDescription tells us where the data for the movie or track lives.
The data can follow the directory, be in the datafork of the same file as the directory resource,
be in the resource fork of the same file as the directory resource, be in another file in the
data fork or resource fork, or require a specific bottleneck to fetch the data. */
/****************************************
*
* MediaDirectory information -
* The MediaDirectory is tightly coupled to the data.
*
****************************************/
/* The SampleDescriptionTable holds the SampleDescriptions needed to decompress chunks given the
SampleDescriptionID. There is a table per Media. */
/*
typedef struct {
long size;
long type;
long resvd1;
short resvdA;
short dataRefBlobId;
} SampleDescription, **SampleDescriptionHandle;
*/
typedef struct {
long size;
long type; /* = 'stsd' */
long flags; /* 1 byte of version / 3 bytes of flags */
long numEntries;
SampleDescription sampleDescTable[kSmallestArray];
} SampleDescriptionAtom;
/* TimeToSampleNum maps physical sample time to physical sample number. */
typedef struct {
long sampleCount;
TimeValue sampleDuration;
} TimeToSampleNum;
typedef struct {
long size;
long type; /* = 'stgs' */
long flags; /* 1 byte of version / 3 bytes of flags */
long numEntries;
TimeToSampleNum timeToSampleNumTable[kSmallestArray];
} TimeToSampleNumAtom;
/* SyncSamples is a list of the physical samples which are self contained. */
typedef struct {
long size;
long type; /* = 'stss' */
long flags; /* 1 byte of version / 3 bytes of flags */
long numEntries;
long syncSampleTable[kSmallestArray];
} SyncSampleAtom;
/* SampleToChunk maps physical sample number to chunk number.
*/
typedef struct {
long firstSample;
long firstChunk;
long samplesPerChunk;
long sampleDescriptionID;
} SampleToChunk;
typedef struct { /* same as SampleToChunk, but redundant first sample is removed */
long firstChunk;
long samplesPerChunk;
long sampleDescriptionID;
} SampleToChunkAlternate1;
typedef enum {
sampleToChunkAlternate1 = 1<<0
} SampleToChunkFlags;
typedef struct {
long size;
long type; /* = 'stsc' */
long flags; /* 1 byte of version / 3 bytes of flags */
long numEntries;
SampleToChunk sampleToChunkTable[kSmallestArray];
} SampleToChunkAtom;
typedef struct {
long size;
long type; /* = 'stco' */
long flags; /* 1 byte of version / 3 bytes of flags */
long numEntries;
long chunkOffsetTable[kSmallestArray];
} ChunkOffsetAtom;
typedef struct {
long size;
long type; /* = 'stsz' */
long flags; /* 1 byte of version / 3 bytes of flags */
long sampleSize;
long numEntries;
long sampleSizeTable[kSmallestArray];
} SampleSizeAtom;
typedef struct {
long size;
long type; /* = 'stbl' */
SampleDescriptionAtom sampleDescription;
TimeToSampleNumAtom timeToSampleNum;
SampleToChunkAtom sampleToChunk;
SyncSampleAtom syncSample;
SampleSizeAtom sampleSize;
ChunkOffsetAtom chunkOffset;
} SampleTableAtom;
typedef struct {
long flags; /* 1 byte of version / 3 bytes of flags */
long componentType; /* mhdr or dhdr */
long componentSubType; /* info to find media handler */
long componentManufacturer;
long componentFlags;
long componentFlagsMask;
char componentName[kSmallestArray];
} PublicHandlerInfo;
typedef struct {
long size;
long type; /* = 'hdlr' */
PublicHandlerInfo hInfo;
} HandlerAtom;
typedef long DataRefAtom; /* a data reference is a private structure */
typedef struct {
long size;
long type; /* = 'dinf' */
DataRefAtom dataRef;
} DataInfoAtom;
typedef struct {
long size;
long type;
long flags; /* 1 byte of version / 3 bytes of flags */
short rgnSize;
Rect rgnBBox;
char data[kSmallestArray];
} RgnAtom;
typedef struct {
long size;
long type;
long flags; /* 1 byte of version / 3 bytes of flags */
PixMap mattePixMap;
ColorTable matteColorTable;
} MatteAtom;
typedef struct {
long size;
long type;
RgnAtom aRgnClip;
} ClippingAtom;
/***********************
* Media Info Example Structures
***********************/
typedef struct {
long flags; /* 1 byte of version / 3 bytes of flags */
short graphicsMode; /* for QD - transfer mode */
short opColorRed; /* opcolor for transfer mode */
short opColorGreen;
short opColorBlue;
} VideoMediaInfoHeader;
typedef struct {
long size; /* size of Media info */
long type; /* = 'vmhd' */
VideoMediaInfoHeader vmiHeader;
} VideoMediaInfoHeaderAtom;
typedef struct {
long size; /* size of Media info */
long type; /* = 'minf' */
VideoMediaInfoHeaderAtom header;
HandlerAtom dataHandler;
DataInfoAtom dataInfo;
SampleTableAtom sampleTable;
} VideoMediaInfo;
typedef struct {
long flags; /* 1 byte of version / 3 bytes of flags */
short balance;
short rsrvd;
} SoundMediaInfoHeader;
typedef struct {
long size; /* size of Media info */
long type; /* = 'vmhd' */
SoundMediaInfoHeader smiHeader;
} SoundMediaInfoHeaderAtom;
typedef struct {
long size; /* size of Media info */
long type; /* = 'minf' */
SoundMediaInfoHeaderAtom header;
HandlerAtom dataHandler;
DataRefAtom dataReference;
SampleTableAtom sampleTable;
} SoundMediaInfo;
typedef struct {
long size;
long type;
/* whatever data the media handler needs goes here */
} MediaInfo;
/***********************
* Media Directory Structures
***********************/
typedef struct {
long flags; /* 1 byte of version / 3 bytes of flags */
long creationTime; /* seconds since Jan 1904 when directory was created */
long modificationTime; /* seconds since Jan 1904 when directory was appended */
TimeValue timeScale; /* start time for Media (Media time) */
TimeValue duration; /* length of Media (Media time) */
short language;
short quality;
} MediaHeader;
typedef struct {
long size;
long type;
MediaHeader header;
} MediaHeaderAtom;
typedef struct {
long size;
long type; /* = 'mdia' */
MediaHeaderAtom mediaHeader; /* standard Media information */
HandlerAtom mediaHandler;
MediaInfo mediaInfo;
} MediaDirectory;
/***********************
* Track Structures
***********************/
enum {
TrackEnable = 1<<0,
TrackInMovie = 1<<1,
TrackInPreview = 1<<2,
TrackInPoster = 1<<3
};
typedef struct {
long flags; /* 1 byte of version / 3 bytes of flags */
long creationTime; /* seconds since Jan 1904 when directory was created */
long modificationTime; /* seconds since Jan 1904 when directory was appended */
long trackID;
TimeValue formerTrackTimeScale; /* start time for track (track time) */
TimeValue duration; /* length of track (track time) */
TimeValue movieTimeOffset; /* this offset is in movie time */
PriorityType priority;
short layer;
short alternateGroup;
short volume;
short reserved1;
MatrixRecord matrix;
Fixed trackWidth;
Fixed trackHeight;
} TrackHeader;
typedef struct {
long size; /* size of track header */
long type; /* = 'tkhd' */
TrackHeader header;
} TrackHeaderAtom;
typedef struct {
TimeValue trackDuration;
TimeValue mediaTime;
Fixed mediaRate;
} EditListType;
typedef struct {
long size;
long type; /* = elst */
long flags; /* 1 byte of version / 3 bytes of flags */
long numEntries;
EditListType editListTable[kSmallestArray];
} EditListAtom;
typedef struct {
long size;
long type; /* = edts */
EditListAtom editList;
} EditsAtom;
typedef struct {
long size;
long type; /* = 'trak' */
TrackHeaderAtom trackHeader; /* standard track information */
ClippingAtom trackClip;
EditsAtom edits;
MediaDirectory media;
UserDataAtom userData; /* space for extending with new data types */
} TrackDirectory;
/****************************************
*
* MovieDirectory -
* The MovieDirectory is the top level structure which
* holds the TrackInstance describing where the
* TrackDirectories are.
*
****************************************/
typedef struct MovieHeader{
long flags; /* 1 byte of version / 3 bytes of flags */
long creationTime; /* seconds since Jan 1904 when directory was created */
long modificationTime; /* seconds since Jan 1904 when directory was appended */
/* Time specifications */
TimeValue timeScale;
TimeValue duration;
Fixed preferredRate; /* rate at which to play this movie */
short preferredVolume; /* volume to play movie at */
short reserved1;
/* Graphics specifications */
long preferredLong1;
long preferredLong2;
/* option is to have a preferred matrix here */
MatrixRecord matrix;
TimeValue previewTime; /* time in track the proxy begins (track time) */
TimeValue previewDuration; /* how long the proxy lasts (track time) */
TimeValue posterTime; /* time in track the proxy begins (track time) */
TimeValue selectionTime; /* time in track the proxy begins (track time) */
TimeValue selectionDuration; /* time in track the proxy begins (track time) */
TimeValue currentTime; /* time in track the proxy begins (track time) */
long nextTrackID; /* next value to use for a TrackID */
} MovieHeader;
typedef struct {
long size;
long type; /* = 'mvhd' */
MovieHeader header;
} MovieHeaderAtom;
typedef struct MovieDirectory{
long size;
long type; /* = 'moov' */
MovieHeaderAtom header;
ClippingAtom movieClip;
/* Track Directories */
struct {
TrackDirectory trackDirectory; /* Track directory information */
} track[kSmallestArray];
/* User data for Movie */
UserDataAtom userData; /* space for user extensions */
} MovieDirectory;
/****************************************
****************************************/
/* Movie formats and tags */
/* some system defined format IDs */
#define MOVIE_TYPE 'moov'
#define TRACK_TYPE 'trak'
#define MEDIA_TYPE 'mdia'
#define VIDEO_TYPE 'vide'
#define SOUND_TYPE 'soun'
#define MIDI_TYPE 'midi'
#define EMPTY_TAG 0x00
#define TEXT_TYPE 'text'
/* An example of some common name sub-types. */
#define COPYRIGHT_TEXT 'cprt'
#define SOURCE_NAME_CUSTOM 'snam'
/* atom id's */
#define MovieAID 'moov'
#define MovieHeaderAID 'mvhd'
#define ClipAID 'clip'
#define RgnClipAID 'crgn'
#define MatteClipAID 'cmat'
#define MatteImageDescAID 'mtid'
#define MatteDataAID 'mtda'
#define TrackAID 'trak'
#define UserDataAID 'udta'
#define TrackHeaderAID 'tkhd'
#define EditsAID 'edts'
#define EditListAID 'elst'
#define MediaAID 'mdia'
#define MediaHeaderAID 'mdhd'
#define MediaInfoAID 'minf'
#define MediaInfoHeaderAID 'mihd'
#define VideoMediaInfoHeaderAID 'vmhd'
#define SoundMediaInfoHeaderAID 'smhd'
#define DataInfoAID 'dinf'
#define DataRefAID 'dref'
#define SampleTableAID 'stbl'
#define STSampleDescAID 'stsd'
#define STGroupToSampAID 'stgs'
#define STSyncSampleAID 'stss'
#define STSampleToChunkAID 'stsc'
#define HandlerAID 'hdlr'
#define STSampleSizeAID 'stsz'
#define STChunkOffsetAID 'stco'
#define DataRefBlobAID 'blob'
#define DataRefContainerAID 'drfc'
#endif _MoviesFormat_